package com.mt.restaurant.entity.sale;

import javax.persistence.*;
import java.io.Serializable;
import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;



import java.util.Date;
import com.mt.restaurant.entity.sale.VegetableMenu;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.mt.restaurant.entity.sale.SaleOrder;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@DEntity(label="菜谱销售记录",comment="",moduleLabel="销售管理")
@Entity(name="restaurant_menu_sale_record")
@Table(name = "restaurant_menu_sale_record" , indexes = { @Index(name = "index_menu_id", columnList = "menu_id"),@Index(name = "index_sale_order_id", columnList = "sale_order_id")  })
@ApiModel(description = "菜谱销售记录:")
public class MenuSaleRecord extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;

	@DColumn(index=3,label="菜谱",foreignEntity="VegetableMenu",comment="菜谱",component="对象选择",where=false)
	@ApiModelProperty(value = "菜谱:菜谱")
	@Column(name="menu_id",length=255,nullable=false,unique=false)
	private Long menuId;

	@Transient
	private VegetableMenu menu;

	@Transient
	@ApiModelProperty(value = "菜谱名称:菜谱")
	@DColumn(index=3,label="菜谱",foreignEntity="VegetableMenu",comment="菜谱")
	private String menuName;

	@Transient
	@ApiModelProperty(value = "菜谱名称:菜谱")
	private Double menuPrice;

	@DColumn(index=4,label="数量",comment="数量",component="数字，整数",where=false)
	@ApiModelProperty(value = "数量:数量")
	@Column(name="amount",length=255,nullable=false,unique=false)
	private Integer amount;

	@DColumn(index=5,label="销售价格",comment="销售价格",component="数字，小数",where=false)
	@ApiModelProperty(value = "销售价格:销售价格")
	@Column(name="price",length=255,nullable=true,unique=false)
	private Double price;

	@DColumn(index=6,label="销售时间",comment="销售时间",component="日期选择",where=false)
	@ApiModelProperty(value = "销售时间:销售时间")
	@Column(name="sale_date",length=255,nullable=true,unique=false)
	@JsonSerialize(using = DateSerializer.class)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date saleDate;

	@DColumn(index=7,label="销售订单",foreignEntity="SaleOrder",comment="销售订单",component="对象选择",where=false)
	@ApiModelProperty(value = "销售订单:销售订单")
	@Column(name="sale_order_id",length=255,nullable=false,unique=false)
	private Long saleOrderId;

	@Transient
	private SaleOrder saleOrder;

	@Transient
	@ApiModelProperty(value = "销售订单名称:销售订单")
	@DColumn(index=7,label="销售订单",foreignEntity="SaleOrder",comment="销售订单")
	private String saleOrderName;

	public Double getMenuPrice() {
		return menuPrice;
	}

	public void setMenuPrice(Double menuPrice) {
		this.menuPrice = menuPrice;
	}

	public Long getMenuId() {
		return this.menuId;
	}

	public void setMenuId(Long menuId) {
		this.menuId = menuId;
	}

	public Integer getAmount() {
		return this.amount;
	}

	public void setAmount(Integer amount) {
		this.amount = amount;
	}

	public Double getPrice() {
		return this.price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Date getSaleDate() {
		return this.saleDate;
	}

	public void setSaleDate(Date saleDate) {
		this.saleDate = saleDate;
	}

	public Long getSaleOrderId() {
		return this.saleOrderId;
	}

	public void setSaleOrderId(Long saleOrderId) {
		this.saleOrderId = saleOrderId;
	}

	public VegetableMenu getMenu() {
		return this.menu;
	}

	public void setMenu(VegetableMenu menu) {
		if(menu == null){
		}
		else
		{
		this.menuId = menu.getEid();
		this.menu = menu;		
		}
}

	public String getMenuName() {
		return this.menuName;
	}

	public void setMenuName(String menuName) {
		this.menuName = menuName;
	}

	public SaleOrder getSaleOrder() {
		return this.saleOrder;
	}

	public void setSaleOrder(SaleOrder saleOrder) {
		if(saleOrder == null){
		}
		else
		{
		this.saleOrderId = saleOrder.getEid();
		this.saleOrder = saleOrder;		
		}
}

	public String getSaleOrderName() {
		return this.saleOrderName;
	}

	public void setSaleOrderName(String saleOrderName) {
		this.saleOrderName = saleOrderName;
	}



}
